﻿module Jzc.Scanner.RegularExpressions

//新加一个类必须改原来的文件，不好，不过先凑合吧，应该也比较稳定
type RegexExpr=
    | SymbolExpr of char
    | EmptyExpr
    | KleeneStarExpr of RegexExpr
    | AlternationExpr of RegexExpr * RegexExpr
    | ConcationExpr of RegexExpr * RegexExpr
    with
        override this.ToString()=
            match this with
            | SymbolExpr(s) -> s.ToString()
            | EmptyExpr -> "ε"
            | KleeneStarExpr(expr) -> "("+expr.ToString()+")*"
            | AlternationExpr(expr1,expr2) -> "("+expr1.ToString()+"|"+expr2.ToString()+")"


//let expr = AlternationExpr( SymbolExpr('a'),EmptyExpr)
//expr.ToString()